Add bounded-memory training and colocation controls#1890
Open
YJHMITWEB wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces several memory optimization features, including CPU-resident microbatches, sequence-dimension chunking for Megatron vocab entropy computation, and a colocated worker memory barrier with optional hard-eviction for inactive reference workers. The review feedback suggests mapping PyTorch device indices to physical GPU indices via CUDA_VISIBLE_DEVICES to ensure accurate NVML memory statistics, and removing a fragile .squeeze(0) call on entropy chunks to robustly support varying input dimensions.
YJHMITWEB
force-pushed
the
memory-efficiency-patches
branch
from
July 16, 2026 18:39
9b6a19a to
8af9294
Compare
YJHMITWEB
force-pushed
the
memory-efficiency-patches
branch
from
July 17, 2026 00:26
8af9294 to
782a8c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bounded-Memory Megatron Training and Colocation
Summary
This PR adds controls that bound temporary training memory and make colocated Megatron offload behavior complete.
Changes
CPU-resident policy microbatches is opt-in; automatic vocabulary-entropy chunk sizing, which defaults to a 512 MiB temporary-memory budget.
Memory Validation